<!--
 * @Description:
 * @version: 服务包详情
 * @Author: 潘骏杰
 * @Date: 2022-03-29 08:03:57
 * @LastEditors: 潘骏杰
 * @LastEditTime: 2022-03-29 09:36:26
-->
<template>
  <div class="re">
    <HeaderNav />
    <div class="text mrbody" style="font-size: 16px; padding: 10px">
      <div class="cardbody">
        <van-col span="18">
          <h2 class="text-center">{{ query.name }}</h2>
          <div class="gray-9 van-ellipsis detail">
            {{ query.detail }}
          </div>
        </van-col>
        <van-col
          span="6"
        ><div class="price"><span>¥</span>{{ query.price }}</div>
        </van-col>
      </div>
      <div class="cardbody">详情...</div>
    </div>
    <van-submit-bar
      button-text="加入购物车"
      :disabled="submiting"
      :loading="submiting"
      button-color="#4A90E2"
      @submit="submit"
    />
  </div>
</template>

<script>
import HeaderNav from '@/components/headerNav/index'
export default {
  name: 'Detail',
  // import引入的组件需要注入到对象中才能使用
  components: { HeaderNav },
  data() {
    // 这里存放数据
    return {
      loading: false,
      submiting: false,
      query: {}
    }
  },
  mounted() {
    console.log(this.$route.query)
    this.query = this.$route.query
  },
  methods: {
    submit() {
      // 加入购物车
      // 走接口 刷新返回
      this.submiting = true
      setTimeout(() => {
        this.submiting = false
        this.$router.go(-1)
      }, 1000)
    }
  }
}
</script>
<style lang="less" scoped>
/deep/ .van-hairline--bottom::after {
  display: none !important;
}
.van-submit-bar__button {
  width: 100% !important;
}

.cardbody {
  overflow: hidden;
  font-size: 16px;
  border-radius: 5px;
  margin: 10px 0;
  width: calc(100% - 40px);
}
h2 {
  text-align: left;
  margin: 0;
}
.detail {
  font-size: 18px;
  width: 95%;
}
.price {
  font-size: 20px;
  text-align: right;
  margin-top: 15px;
}
.price span {
  font-size: 12px;
}
</style>
